#!/bin/bash
set -e
ulimit -n 1000000

DEPLOY_DIR={{ deploy_dir }}
cd "${DEPLOY_DIR}" || exit 1

{% set my_ip = hostvars[inventory_hostname].ansible_host | default(hostvars[inventory_hostname].inventory_hostname) -%}

exec > >(tee -i -a "{{ elasticsearch_exporter_log_dir }}/{{ elasticsearch_exporter_log_filename }}")
exec 2>&1

exec bin/elasticsearch_exporter \
    --es.uri="http://{{ my_ip }}:{{ elasticsearch_exporter_port }}"

